#include "gus2.h"
void gui_ctrl_set_attr_init(bytearray_t* ba, bytearray_t* segment, u32 handle) {
	byte_array_segment_init(ba, segment, -1);
	byte_array_preset_cnt(segment);
	byte_array_serial(segment, "db", handle, 0x57);
}
void gui_ctrl_set_attr_flush(bytearray_t* ba, bytearray_t* segment)
{
	byte_array_preset_cnt(segment);
	// Merge segment
	byte_array_segment_merge(ba, segment);
	utils_exector_cmd_inc(ba);
}
void gui_ctrl_set_attrs(bytearray_t* ba, const char* format, ...) {
	int count = 0;
	va_list argp;
	GUS2_UNUSE(count);
	va_start(argp, format);
	count = byte_array_vserial(ba, format, argp);
	va_end(argp);
}

void gui_ctrl_iset(bytearray_t* ba, u32 src_handle, u8 src_attr, u32 dst_handle, u8 dst_attr, egui_cvt_t cvt) {
	bytearray_t seg;
	gui_ctrl_set_attr_init(ba, &seg, 0);
	// iset attr 0x04
	byte_array_serial(&seg, "b", 0x4);
	// src handle attr
	byte_array_serial(&seg, "db", src_handle, src_attr);
	// dst handle attr
	byte_array_serial(&seg, "db", dst_handle, dst_attr);
	// cvnt
	byte_array_serial(&seg, "d", cvt);
	gui_ctrl_set_attr_flush(ba,&seg);
}


